1
/****************************** Module Header ******************************\
2 * Module Name: HtmlCheckBox.cs
3 * Project: CSWebBrowserAutomation
4 * Copyright (c) Microsoft Corporation.
6 * This class HtmlCheckBox represents an HtmlElement with the tag "input" and its
9 * This source is subject to the Microsoft Public License.
10 * See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL.
11 * All other rights reserved.
13 * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
14 * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
15 * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
16 \***************************************************************************/
18 using System
.Windows
.Forms
;
19 using System
.Security
.Permissions
;
21 namespace CSWebBrowserAutomation
23 public class HtmlCheckBox
: HtmlInputElement
25 public bool Checked { get; set; }
28 /// This parameterless constructor is used in deserialization.
30 public HtmlCheckBox() { }
33 /// Initialize an instance of HtmlCheckBox. This constructor is used by
34 /// HtmlInputElementFactory.
36 [PermissionSetAttribute(SecurityAction
.LinkDemand
, Name
= "FullTrust")]
37 public HtmlCheckBox(HtmlElement element
)
41 // The checkbox is checked if it has the attribute "checked".
42 string chekced
= element
.GetAttribute("checked");
43 Checked
= !string.IsNullOrEmpty(chekced
);
47 /// Set the value of the HtmlElement.
49 [PermissionSetAttribute(SecurityAction
.LinkDemand
, Name
= "FullTrust")]
50 public override void SetValue(HtmlElement element
)
52 // The checkbox is checked if it has the attribute "checked".
55 element
.SetAttribute("checked", "checked");
59 element
.SetAttribute("checked", null);